<template>
    <div>
        <LangHeaderS :styleColor="1" />
        <div class="page-content">
            <div class="main-wrap">
                <div :class="$store.getters.screenWidth > 1000 ? 'bread-crumb-box' : 'h5s'">
                    <div class="width-1360">
                        <img src="@/assets/img/home.png" class="home-icon">
                        <span>{{ $t('h.currentLoc') }}：</span>
                        <span>
                            <router-link to="/lang-index">&nbsp;{{ $t('h.home') }}</router-link>
                            <img src="@/assets/img/right.png" class="left-icon">
                        </span>
                        <span>
                            <span class="now" v-if="items && items.article && items.article.post_title">{{items.article.post_title}}</span>
                        </span>
                    </div>
                </div>
                <div class="waper">
                    <div class="left">
                        <div v-if="items &&  items.article && items.article.post_content" v-html="getHtml(items.article.post_content)"> </div>
                    </div>
                    <div class="rigth">
                        <div class="title">{{ $t('h.Cultural') }}</div>
                        <ul  v-if="items &&  items.article " >
                            <li @click="getId(item.id)" v-for="item in info" :key="item.id"
                                :class="{ cative: item.id == id }"><i class="l-iconfont icon">&#xe687;</i>{{
                                item.article.post_title }} </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <LangFooterS />
    </div>
</template>
<script>

import LangHeaderS from '@/components/Lang-Header.vue'
import LangFooterS from '@/components/Lang-Footer.vue'
export default ({
    components: {
        LangHeaderS,
        LangFooterS
    },
    data() {
        return {
            content: '', // 初始内容，可以是富文本HTML字符串
            info: {},
            id: '',
            items: {},
            type:0
        }
    },
    computed: {
        lang() {
            return sessionStorage.getItem('lang')
        },
        screenWidth() {
            return this.$store.getters.screenWidth
        },

    },
    created() {
        // window.scrollTo({ top: 0, behavior: 'smooth' });
        this.type = this.$route.query.type || ''
        this.getData()
    },
    methods: {
        getId(id) {
            this.id = id
            this.items = this.info.filter(i => i.id == this.id)[0]
        },
        getHtml(str) {
            let strs = str.replace(/<img /g, '<img style="max-width:100%;height:auto;" ')
            return strs.replace(/<video /g, '<video style="max-width:100%;height:auto;" ');
        },
        getData() {
            this.$api.getOtherXa({ lang: this.lang }).then(res => {
                if (res.data.code == 1) {
                    this.info = res.data.data.list
                    if (!this.type) {
                        this.id = this.info[0].id
                        this.items = this.info.filter(i => i.id == this.id)[0]
                        return
                    }
                    this.id = this.info[this.type-1].id
                    this.items = this.info.filter(i => i.id == this.info[this.type-1].id)[0]
                    console.log('查看',this.info,this.items,this.id);
                    
                }

            })
        },
        handleSizeChange(val) {
            console.log(`每页 ${val} 条`);
        },
        handleCurrentChange(val) {
            console.log(`当前页: ${val}`);
        }
    }
})
</script>
<style lang="scss" scoped>
.page-content {
    width: 100%;
    background-color: #f5f5f5;
    padding-bottom: 5.20833vw;
}

.bread-crumb-box {
    ::v-deep span {
        a:hover {
            color: #e31c1c;
        }
    }
}

.waper {
    width: 70.83333vw;
    height: 100%;
    background-color: #fff;
    margin: 0 auto;
    display: -webkit-box;
    display: flex;
}

.waper .left {
    width: 70%;
    border-right: 1px solid #dedede;
    padding: 3.125vw;
}

.waper .rigth {
    width: 30%;
    height: 100%;
    padding: 3.125vw 2.39583vw;
}

.waper .rigth .title {
    font-family: TimesNewRomanPS-BoldMT;
    font-size: 1.875vw;
    font-weight: bold;
    font-stretch: normal;
    line-height: 2.5vw;
    letter-spacing: 0px;
    color: #666666;
}

.waper .rigth ul {
    margin-top: 1.66667vw;
}

ul,
li,
ol {
    list-style: none outside none;
}

.waper .rigth ul li {
    cursor: pointer;
    margin-top: 1.04167vw;
    display: -webkit-box;
    display: flex;
    -webkit-box-align: center;
    align-items: center;
    color: #666666;
}

.waper .rigth ul .cative {
    color: #e31c1c;
}

.bread-crumb-box {
    padding: 2.60417vw 0 3.125vw;
}

.waper .rigth ul li .icon {
    font-size: 0.72917vw;
    margin-right: 0.78125vw;
}

.main-wrap .main {
    width: 70.83333vw;
    margin: 0 auto;
    background: #fff;
    overflow: hidden;
}

.bread-crumb-box .width-1360 {
    display: -webkit-box;
    display: flex;
    -webkit-box-align: center;
    align-items: center;
}

.width-1360 {
    width: 70.83333vw;
    margin: 0 auto;
}

.main-wrap {
    padding-top: 3.64583vw;
}

.bread-crumb-box .home-icon {
    width: 0.88542vw;
    line-height: 1;
    color: #999;
    margin-right: 0.52083vw;
    display: inline-block;
    vertical-align: middle;
}

.bread-crumb-box span {
    display: inline-block;
    vertical-align: middle;
    font-size: 0.72917vw;
    font-weight: 400;
    color: #666;
    line-height: 0.9375vw;
}

.bread-crumb-box span a {
    color: #666;
}

.bread-crumb-box .left-icon {
    color: #666;
    margin: 0 0.52083vw;
    display: inline-block;
    vertical-align: middle;
}

.bread-crumb-box span:nth-last-of-type(1) {
    color: #333;
}

.bread-crumb-box span .now {
    color: #e31c1c
}

@media(max-width:1000px) {
    .main {
        padding-top: 0;
    }

    .h5s-content {
        min-height: -webkit-calc(100vh - 6rem);
        min-height: calc(100vh - 6rem);
    }

    .h5s {
        font-size: 0;
        padding: 0.5rem 0;
    }

    .h5s .width-1360 {
        width: 100%;
        padding: 0 0.3rem;
        font-size: 0.2rem;
        color: #666;
        display: -webkit-box;
        display: flex;
        -webkit-box-align: center;
        align-items: center;
    }

    .h5s .width-1360 .home-icon {
        width: 0.22rem;
        margin-right: 0.1rem;
    }

    .h5s .width-1360 a {
        color: #666;
    }

    .h5s .width-1360 .left-icon {
        margin: 0 0.1rem;
    }

    .h5s span .now {
        color: #e31c1c
    }

    .main-wrap {
        padding-top: 0;
    }

    .main-wrap .main {
        width: 100%;
        padding: 0 0.3rem;
        margin: 0 auto;
        background: #fff;
        overflow: hidden;
    }

    .waper {
        width: 95vw;
    }

    .waper .rigth {
        padding: 2.125vw 2.39583vw;
    }

    .waper .rigth ul li {
        font-size: 0.15rem;
    }

    .waper .left {
        font-size: 0.2rem;
    }
}
</style>